﻿@using DotNetDream.Models;
@using DotNetDream.Helper;
@model DotNetDream.Models.Blog
@{
    ViewBag.Title = "DotNetDream - Blog";
}
<h1>
    @Model.Name</h1>
<div id="dnd-content-wrapper">
    <div id="dnd-command-bar">
        <div class="dndAnchorButton">
            @Html.ActionLink("New Entry", "CreateEntry", "Entry", new { blogId = Model.Id }, null)
        </div>
    </div>
    <div id="dnd-content">
        @if (Model.BlogEntries.Count > 0)
        {
            foreach (var item in Model.BlogEntries)
            {
            <div class="dndBlogEntry">
                <div class="dndContainerHeader">
                    @Html.DisplayFor(entry => item.Title)
                    <label>
                        &nbsp;@item.Created.ToString("dd/MMM/yyyy HH:mm")</label>
                    @Html.ViewAccountLink(item.BlogUser.Id)
                </div>
                <div class="dndContainerContent">
                    @Html.Raw(item.Summary)
                    <div>
                        @Html.ActionLink(string.Format("[Full Entry]", item.BlogEntryComments.Count), "ViewEntry", "Entry", new { id = item.Id, year = Model.Year, month = Model.Month, page = Model.CurrentPage }, null)
                    </div>
                </div>
                <div class="dndContainerFooter">
                    @Html.ActionLink(string.Format("({0})", item.BlogEntryComments.Count), "ViewEntry", "Entry", new { id = item.Id, year = Model.Year, month = Model.Month, page = Model.CurrentPage }, null)
                    <label>
                        Comments&nbsp;</label>
                </div>
            </div>
            }
            <div id="dnd-footer-bar">
                @if (Model.CurrentPage > 1)
                {
                    <div class="dndAnchorButton floatLeft">
                        @Html.ActionLink("Previous", "ViewBlog", new { year = Model.Year, month = Model.Month, page = Model.CurrentPage - 1 }, null)
                    </div>
                }
                <div class="dndAnchorButton floatRight">
                    @Html.ActionLink("Next", "ViewBlog", new { year = Model.Year, month = Model.Month, page = Model.CurrentPage + 1 }, null)
                </div>
            </div>
        }
        else
        {
            <div class="dndBlogEntry">
                <div class="dndContainerHeader">
                    No entries found.
                </div>
            </div>
            <div id="dnd-footer-bar">
                <div class="dndAnchorButton floatLeft">
                    @Html.ActionLink("Previous", "ViewBlog", new { year = Model.Year, month = Model.Month, page = Model.CurrentPage - 1 }, null)
                </div>
            </div>
        }
        <div id="dnd-blog-archive">
            <div class="dndContainerHeader">
                Archives @Html.ActionLink("View all", "ViewBlog")
            </div>
            @*<div>
                <ul class="archiveYear">
                    @foreach (Blog.ArchiveYear archiveYear in Model.Archives)
                    {
                        <li>
                            <label>@archiveYear.Year @Html.ActionLink(string.Format("({0})", archiveYear.EntryCount), "ViewBlog", new { id = Model.Id, year = archiveYear.Year })</label>
                            <ul class="archiveMonth">
                                @for (int i = 0; i < archiveYear.Month.Length; i++)
                                {
                                    <li>@Enum.GetName(typeof(Constant.MonthOfYear), i) @Html.ActionLink(string.Format("({0})", archiveYear.Month[i]), "ViewBlog", new { id = Model.Id, year = archiveYear.Year, month = i + 1 })</li>
                                    if (archiveYear.Year == DateTime.Now.Year && (DateTime.Now.Month == i + 1)) { break; }
                                }
                            </ul>
                        </li>
                    }
                    <li>
                        <label>
                            2012 <a href="#">(0)</a></label>
                        <ul class="archiveMonth">
                            <li>4</li>
                            <li>3</li>
                            <li>1</li>
                            <li>2</li>
                            <li>4</li>
                            <li>3</li>
                            <li>1</li>
                            <li>2</li>
                            <li>4</li>
                            <li>3</li>
                            <li>1</li>
                            <li>2</li>
                            <li>4</li>
                        </ul>
                    </li>
                </ul>
            </div>*@
        </div>
    </div>
</div>
